import axios from 'axios';
import { reactive } from 'vue';

export default function () {

    let idnum = 2;

    

    let list = reactive([{
        id:1,
        address:"https://images.dog.ceo/breeds/pembroke/n02113023_4373.jpg",
    }
      
    ]);

    async function addImg() {
      try {
        let result = await axios.get(
          "https://dog.ceo/api/breed/pembroke/images/random"
        );

        let obj = {
            id:0,
            address:"null",
        }

        obj.id = idnum++;
        obj.address = result.data.message

        list.push(obj);

      } catch (err) {
        console.log(err, "err");
      }
    }
    return {list,addImg}
  }